﻿#include <iostream>
#include <format>

using namespace std;

class A
{
public:
	static A A_default;

	A(int x = 0, int y = 0): A_x(x), A_y(y) {}
	
	void A_print() {
		cout << format("A_x = {}, A_y = {}", A_x, A_y) << endl;
	}

protected:
	int A_x;
	int A_y;
};

A A::A_default(0, 0);

class B: public A
{
public:
	static B B_default;

	B(int x = 0, int y = 0, A &A = A::A_default) : B_x(x), B_y(y), A(A) {}

	void B_print() {
		cout << format("B_x = {}, B_y = {}", B_x, B_y) << endl;
	}
protected:
	int B_x;
	int B_y;
};

B B::B_default(0, 0);

class C : public B
{
public:
	static C C_default;

	C(int x = 0, int y = 0, B &B = B::B_default) : C_x(x), C_y(y), B(B) {}

	void C_print() {
		cout << format("C_x = {}, C_y = {}", C_x, C_y) << endl;
	}
protected:
	int C_x;
	int C_y;
};

C C::C_default(0, 0);

int main(){
	B b(1, 2);
	b.B_print();
	b.A_print();

	C c(3, 4, b);
	c.C_print();
	c.B_print();
	c.A_print();
}
